Digital Signal Processors (DSPs), such as a Micro Signal Architecture (MSA) DSP, may use one or more Single-Access Memory (SAM) unit. One or more data bus may connect the SAM unit to the DSP. In such architecture, in each machine cycle, only one operand may be read from a given SAM unit. In order to load two operands simultaneously, a DSP may use two SAM units connected via two, respective, data buses. In some DSP applications, for example, in some MSA DSP applications, each SAM unit is located on a separate memory bank. A DSP may also be associated with a stack memory, which may include a data area or a buffer for storing data or requests for data to be handled by the DSP. The stack memory may be located on one of the SAM units.
In the field of digital signal processing, a processor, such as a DSP, may be associated with one or more Arithmetic Logic Unit (ALU). A DSP may be designed to load two operands from memory in parallel in one machine cycle, and an ALU may be designed to operate on two operands in the same machine cycle.
In programs and software applications running on a computer platform or a dedicated hardware implementation, there may be local variables and/or global variables. A local variable may have a limited scope, and may exist only within a block of a code or a function in which it is defined. A global variable, on the other hand, may exist and may be accessed from anywhere in a code, or by more than one function.
A program written in a high level programming language, for example, C or C++, may be converted to a machine language using a compiler. Local variables are allocated by the compiler to a predefined stack memory, whereas global variables may be defined arbitrarily on any SAM bank.
Two operands cannot be loaded simultaneously from one SAM bank. For example, if a DSP needs to load two operands from the SAM bank, the loading may take at least two machine cycles. If the two operands are local variables, the compiler allocates both variables on the stack memory defined on the SAM bank, whereby the DSP cannot load the two variables simultaneously. Therefore, current stack memory architectures are inefficient when used in conjunction with SAM.
The inefficiency of current stack memory architectures may be further described by referring to a specific example, as follows. A DSP may perform a Multiply-and-Accumulate (MAC) operation, for example, reg+=x[i]*y[i]. Such operation may require loading two operands in parallel. If x[ ] and/or y[ ] are local array variables, then a compiler may face a problem when trying to satisfy two requirements. Since x[ ] and/or y[ ] are local array variables, the compiler will allocate x[ ] and y[ ] on the stack memory. Further, since a MAC operation may require loading two operands in parallel, the operation may require allocating x[ ] and y[ ] in separate SAM banks. These two requirements may be contradicting, and may cause problems and inefficiency in programming and/on performance. For example, a programmer may be required to implement a specific solution, which may be manually tailored for a specific configuration and may involve manual changes to multiple files. Additionally, a programmer may need to define and use a copy or several copies of variables and arrays, involving additional programming time and requiring more memory resources.
It will be appreciated that for simplicity and clarity of illustration, elements shown in the figures have not necessarily been drawn to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity. Further, where considered appropriate, reference numerals may be repeated among the figures to indicate corresponding or analogous elements.